package cn.tutu.blockchain.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.tutu.blockchain.utils.HttpUtils;
import net.sf.json.JSONObject;

@RequestMapping("/ckt")
@RestController
public class CktController {

	@RequestMapping("/requestDirect")
	public Object requestDirect(String url, String para, String phone) {

		Map<String, String> head = new HashMap<String, String>();
		head.put("content-type", "Content-Type:application/json;charset=UTF-8");
		head.put("channel", "APP");
		head.put("rt", phone);
		//Map<String,String> map = new HashMap<String,String>();
		//map.put("addr","0x3aff1671d8428da1b9f08c590dfa2c83e54deb3d");
		//String para1 = JSONObject.fromObject(map).toString();
		String responseBody = HttpUtils.postData(url, para, head);
		JSONObject object = JSONObject.fromObject(responseBody);
		return object;

	}
	
	public static void main(String[] args) {
		Map<String,String> map = new HashMap<String,String>();
		map.put("addr","0x3aff1671d8428da1b9f08c590dfa2c83e54deb3d");
		String para = JSONObject.fromObject(map).toString();
		System.out.println(para);
	}
}
